(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  define(['views/base/view', 'alertify'], function(BaseView, alertify) {
    'use strict';
    var BaseItemView, _ref;
    return BaseItemView = (function(_super) {
      __extends(BaseItemView, _super);

      function BaseItemView() {
        _ref = BaseItemView.__super__.constructor.apply(this, arguments);
        return _ref;
      }

      BaseItemView.prototype.tagName = 'tr';

      BaseItemView.prototype.events = {
        'click [name="delete"]': 'clickDeleteHandler'
      };

      BaseItemView.prototype.removeConfirmMessage = 'Deseja remover esse registro?';

      BaseItemView.prototype.removedMessage = 'Registro removido';

      BaseItemView.prototype.clickDeleteHandler = function(event) {
        var _this = this;
        event.preventDefault();
        return alertify.confirm(this.removeConfirmMessage, function(confirmed) {
          var promise;
          if (confirmed) {
            promise = _this.model.destroy({
              wait: true
            });
            return promise.done(function() {
              return _this.publishEvent('feedback:success', _this.removedMessage);
            });
          }
        });
      };

      return BaseItemView;

    })(BaseView);
  });

}).call(this);
